package com.maxsalad.baidu.service;

import com.maxsalad.baidu.entity.RequestCmd;
import com.maxsalad.baidu.util.SignUtil;
import com.maxsalad.common.util.PropertiesUtil;

import java.security.NoSuchAlgorithmException;

/**
 * Created by 2014-400 on 2016-03-07.
 */
public abstract class BaseService {
    protected String getBaseUrl() throws Exception {
        return PropertiesUtil.getValue("BAIDU_URL");
    }

    protected String getSource() throws Exception {
        return PropertiesUtil.getValue("BAIDU_SOURCE");
    }

    protected String getSecret() throws Exception {
        return PropertiesUtil.getValue("BAIDU_SECRET");
    }

    protected String getShopId() throws Exception {
        return PropertiesUtil.getValue("BAIDU_SHOP_ID");
    }

    protected String getShopName() throws Exception {
        return PropertiesUtil.getValue("BAIDU_SHOP_NAME");
    }

    protected String getSign(RequestCmd cmd) throws NoSuchAlgorithmException {
        return SignUtil.getSign(cmd);
    }
}
